Skip to content

fix(calendar): recover from fetch errors promptly, track errors per calendar - #4342

Merged
KristjanESPERANTO merged 6 commits into
MagicMirrorOrg:developfrom
MikeBishop:claude/calendar-connection-errors-e062fc
Dec 1, 2026
Merged

KristjanESPERANTO merged 6 commits into
MagicMirrorOrg:developfrom
MikeBishop:claude/calendar-connection-errors-e062fc

Conversation

@MikeBishop

@MikeBishop MikeBishop commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Sporadic "No internet connection." messages blanked the whole calendar after a single transient fetch error, even when other calendars were fine and cached events existed. The message could also linger after the connection came back.

Following the review discussion, this no longer adds an option. Instead:

  • Grace period: network and server (5xx) errors are not shown while the HTTP fetcher still has retries left (3 retries with 15s/30s backoff, so roughly 45s for fast failures, longer when requests time out). Auth, rate-limit, client and parse errors are shown immediately.
  • Failures are attributed to their calendar: when a calendar keeps failing, the other calendars keep displaying. The failing calendar's events stay visible but get the stale class and a warning icon (stale-icon), and a stale-note row names the calendar (its name, or else the hostname) and the error, e.g. Work: No internet connection. Default styling is in calendar.css and can be overridden in custom.css.
  • Full-module error only when there are no events to display, or the error can't be attributed to a calendar (malformed URL).
  • Recovery: a successful fetch clears that calendar's error and redraws immediately, even if the events checksum is unchanged.
  • Fix: the malformed-URL and missing-fetcher errors were sent without the module id, so the front end dropped them and the calendar stayed on "Loading…".
  • Unit tests for the front-end error handling, CalendarFetcher#isTransientError, and the node_helper error notifications.

No related issue.

🤖 Generated with Claude Code

…alendar

A single transient network error replaced the whole calendar with
"No internet connection", and the message could linger after recovery
because an unchanged events checksum skipped the redraw.

- Track errors per calendar URL; clear and redraw on a successful fetch
- Include url in CALENDAR_ERROR notifications
- Add keepEventsOnError option (default false) to keep showing the last
  known events when a later fetch fails

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

Thanks for the PR!

Speaks something against enabling this behavior permanently and omit the new opt-in option?

@MikeBishop

Copy link
Copy Markdown
Contributor Author

Considered that, but it means that the error isn't visible from the screen unless all calendars have failed from the start. Some people might prefer to see an error so they can fix it. Some visual cue that the shown events are stale might be an alternative.

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

Good point. What do you think of using a small grace period instead of a new config option - e.g. keeping existing events for the first 2 or 3 consecutive fetch failures and only showing the error if it persists? That would handle transient glitches by default while still surfacing permanent errors.

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

@KristjanESPERANTO Are you still open to work on this? 🙂

@MikeBishop

Copy link
Copy Markdown
Contributor Author

Yes, just AFK due to travel for work and holidays. I'll take another look at this.

Mike Bishop and others added 5 commits November 30, 2026 10:25
Network and server errors are retried with backoff by the HTTP fetcher.
Only report them to the front end once retries are used up; auth,
rate-limit, client and parse errors are still reported immediately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When one calendar keeps failing, keep showing the events of the others.
Events of the failing calendar get the `stale` class and a warning icon
(`stale-icon`), and a `stale-note` row names the calendar and the error.
The full module error is only shown when there are no events to display
or the error can't be attributed to a calendar.

Removes the `keepEventsOnError` option, which this makes unnecessary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…notes

The malformed-url and missing-fetcher errors were sent without the module
id, so the front end dropped them and the calendar stayed on "Loading…".
Send the id (and the url where there is one, so the error can clear).

Several unnamed calendars on the same host failing the same way (e.g.
two Outlook feeds during an outage) now produce one note instead of
identical duplicates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MikeBishop

MikeBishop commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

I removed the option and added indication of stale events / failing calendars. The full-module error can still happen, but only if no events are available.

preview preview

Transient errors ride out a few retries before any of this shows, as you suggested; hard errors (auth, etc.) get it immediately.

@KristjanESPERANTO KristjanESPERANTO left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks good to me. This really makes the calendar module more robust 🚀🙂

@KristjanESPERANTO
KristjanESPERANTO merged commit 4c03328 into MagicMirrorOrg:develop Dec 1, 2026
15 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants